require("../../assets/css/basic.less");
require("../../assets/css/normalize.css");
require("../../assets/css/property.css");
require("../../assets/css/reset.css");
require("./ad.css");

// 引入js模块
const dom = require("../../libs/dom.js");

document.addEventListener("DOMContentLoaded", function () {
	/**
	 * 元素获取
	 * 所有元素的集合
	 */
	// const skipBtn = document.querySelector("#skipBtn");
	// const timeBtn = document.querySelector("#timeBtn");

	/**
	 * 自动倒计时5s
	 */
	let time = 5;
	const timer = setInterval(function () {
		--time;
		dom.get("#timeBtn").textContent = time + "s";
		if (time === 0) {
			location.href = "./login.html";
			clearInterval(timer);
			return;
		}
		//小于0 结束
	}, 1000);

	/**
	 * 点击skipbtn停止计时并跳转
	 */
	dom.get("#skipBtn").addEventListener("click", function () {
		clearInterval(timer);
		location.href = "./login.html";
	});
});
